<?php
namespace app\admin\controller;

class Base extends \think\Controller{

    protected $auth_user;

    /**
     * 初始
     */
    public function _initialize(){
        ($auth_ticket = cache('admin_auth_ticket')) or $this->redirect('auth/login');
        ($userinfo = json_decode(encrypt($auth_ticket), true)) and ($userinfo = \model\User::get($userinfo['id'])) and encrypt((string)$userinfo, '', 7200) and $this->assign('auth_user', $userinfo);
        empty($userinfo) and $this->redirect('auth/login');
        $this->auth_user = $userinfo;
    }

    /**
     * 首页
     */
    public function index(){
        // do more ...
        return $this->fetch('index');
    }
}
